<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
	#div1	{width: 200px; height: 200px; background: #CCC; margin: 100px; position:relative}
	#div2 {width: 100px; height: 100px; background: red; position:absolute;left: 50px; top: 50px;}
</style>
<script>
window.onload=function()
{
		var oDiv = document.getElementById('div2');
	
		alert(oDiv.offsetParent);
};
</script>
</head>

<body>
<div id="div1">
	<div id="div2">
		
	</div>
	
</div>
</body>
</html>
